import { Box, MenuItem, Select } from "@mui/material";
import React from "react";
import { useEffect } from "react";
import { useContext } from "react";
import { classContext } from "./StudentAccount";

export default function Class(params) {
  //
  const classNames = useContext(classContext);

  return (
    <Box>
      <Select
        labelId="demo-simple-select-label"
        id="demo-simple-select"
        value={params.value}
        label="班级"
        variant="standard"
        size="small"
        onChange={(e) =>
          classNames.handleChange({ ...params.row, classId: e.target.value })
        }
      >
        {classNames.classNames.map((val) => (
          <MenuItem value={val.id}>{val.grade + "级" + val.name}</MenuItem>
        ))}
      </Select>
    </Box>
  );
}
